package org.soderiakelvy.controller.menu;

import java.io.Serializable;
import java.util.Map;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;

import org.soderiakelvy.controller.util.Constante;
import org.soderiakelvy.model.domain.SucursalVO;
import org.soderiakelvy.model.domain.SujetoVO;


@ManagedBean 
public class MenuController implements Serializable {

	private static final long serialVersionUID = -6092890164552502465L;

	public MenuController(){
		
	}
	
	public String altaSujetoEmpresa(){
		System.out.println("Redireccionando...");
		String result = Constante.SUJETO_EMPRESA_CREATE;
		FacesContext fc = FacesContext.getCurrentInstance();
		Map<String,Object> sessionParams = fc.getExternalContext().getSessionMap();
		sessionParams.put("tipoCrud", result);
    	return "sujetoEmpresaContribucion.xhtml?faces-redirect=true";
	}
	
	public String altaSujetoResidencial(){
		SucursalVO suc = new SucursalVO();
		SujetoVO suj = new SujetoVO();
		suj.setTipoSujeto(Constante.SUJETO_RESIDENCIAL);
		suc.setSujeto(suj);
		String result = Constante.SUCURSAL_CREATE;
		
		FacesContext fc = FacesContext.getCurrentInstance();
		Map<String,Object> sessionParams = fc.getExternalContext().getSessionMap();
		sessionParams.put("tipoCrudSucursal", result);
		sessionParams.put("sucursalCreate", suc);
    	return "sujetoEmpresaSucursal.xhtml?faces-redirect=true";
	}
}
